import matplotlib.pyplot as plt
import numpy as np

# 数据
quarters = ['2023 Q1', '2024 Q1']
total_assets = [13595994070.72, 12834229283.82]
total_liabilities = [9228236071.55, 8456311780.16]
equity = [4367758000.17, 4377917503.66]
growth_rates = [14.33, 11.81]  # 根据图表数据假设的增长率

# 设置柱状图的位置
x = np.arange(len(quarters))
width = 0.2

# 创建图表
fig, ax1 = plt.subplots()

# 绘制柱状图
ax1.bar(x - width, total_assets, width, label='Total Assets', color='skyblue')
ax1.bar(x, total_liabilities, width, label='Total Liabilities', color='lightgreen')
ax1.bar(x + width, equity, width, label='Equity', color='salmon')

# 设置标签和标题
ax1.set_xlabel('Quarter')
ax1.set_ylabel('Amount (Unit: RMB)')
ax1.set_title('Financial Structure and Growth Rate Analysis')
ax1.set_xticks(x)
ax1.set_xticklabels(quarters)
ax1.legend(loc='upper left')

# 创建第二个y轴
ax2 = ax1.twinx()
ax2.plot(quarters, growth_rates, color='gold', marker='o', label='Growth Rate (%)')
ax2.set_ylabel('Growth Rate (%)')
ax2.legend(loc='upper right')

# 显示图表
plt.show()